package com.mjing.utils;

import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;

import java.io.IOException;

public class Base64Convert {

    public  static String getBase64StringDecoding(String codingStr){
        BASE64Decoder base64Decoder = new BASE64Decoder();
        String returnStr = String.valueOf("");
        try {
            returnStr= new String(base64Decoder.decodeBuffer(codingStr),"UTF-8");
        } catch (IOException e) {
            e.printStackTrace();
        }
        return returnStr;
    }
    public static   String getBase64StringEncoding(String codingStr){
        BASE64Encoder base64Encoder = new BASE64Encoder();
        String returnStr = String.valueOf("");
        try {
            returnStr= base64Encoder.encodeBuffer(codingStr.getBytes("UTF-8"));
        } catch (IOException e) {
            e.printStackTrace();
        }
        return returnStr;
    }
}
